import { Button, Popconfirm, Space } from 'antd'

export const getColumns = (
    handleDelete: (key: React.Key) => void,
    handleEdit: (record: any) => void,
    handleRole: (record: any) => void,
) => [
    {
        title: '角色',
        dataIndex: 'name',
        key: 'name',
    },
    {
        title: '描述',
        dataIndex: 'description',
        key: 'description',
        width: 300,
    },
    {
        title: '创建时间',
        dataIndex: 'createTime',
        key: 'createTime',
    },
    {
        title: '操作',
        key: 'action',
        render: (_: any, record: any) => (
            <Space size="middle">
                <Button type="link" onClick={handleEdit(record)}>
                    编辑
                </Button>
                {/* <Button type="link" onClick={handleRole(record)}>
                    分配权限
                </Button> */}
                <Popconfirm
                    title="你确定删除吗?"
                    onConfirm={() => handleDelete(record.id)}
                >
                    <Button type="link">删除</Button>
                </Popconfirm>
            </Space>
        ),
    },
]
